\usepackage{fontspec,xunicode,xltxtra}
\usepackage{xeCJK}

\usepackage[usenames,dvipsnames]{color}
\definecolor{steelblue}{rgb}{.275,.51,.71}
\definecolor{lpink}{rgb}{.991,.711,.754}
\definecolor{mygray}{gray}{0.92}
\definecolor{darkblue}{rgb}{0,0,.5}
\definecolor{darkgreen}{rgb}{0,.39,0}
\definecolor{hgray}{gray}{.5}
\definecolor{lgray}{gray}{.8}

\setCJKfamilyfont{akai}{Adobe Kaiti Std}
\newcommand{\akai}[1]{\CJKfamily{akai} #1}
\setCJKfamilyfont{ahei}{Adobe Heiti Std}
\newcommand{\ahei}[1]{\CJKfamily{ahei} #1}
\setCJKfamilyfont{asong}{Adobe Song Std}
\newcommand{\asong}[1]{\CJKfamily{asong} #1}
\setCJKfamilyfont{afsong}{Adobe Fangsong Std}
\newcommand{\afsong}[1]{\CJKfamily{asong} #1}


\setCJKfamilyfont{hei}{SimHei}
\newcommand{\hei}[1]{\CJKfamily{hei} #1}
\setCJKfamilyfont{cyun}{STCaiyun}
\newcommand{\cyun}[1]{\CJKfamily{cyun} #1}
\setCJKfamilyfont{song}{SimSun}
\newcommand{\song}[1]{\CJKfamily{song} #1}
\setCJKfamilyfont{yyuan}{YouYuan}
\newcommand{\yyuan}[1]{\CJKfamily{yyuan} #1}
\setCJKfamilyfont{kai}{KaiTi_GB2312}
\newcommand{\kai}[1]{\CJKfamily{kai} #1}
\setCJKfamilyfont{dkuan}{WenQuanYi Micro Hei Mono}
\newcommand{\dkuan}[1]{\CJKfamily{dkuan} #1}
\setCJKfamilyfont{fangsong}{FangSong_GB2312}
\newcommand{\fsong}[1]{\CJKfamily{fangsong} #1}
\setCJKfamilyfont{xkai}{STXingkai}
\newcommand{\xkai}[1]{\CJKfamily{xkai} #1}
\setCJKfamilyfont{loli}{DFGirl:style=Regular}
\newcommand{\loli}[1]{\CJKfamily{loli} #1}

\setmainfont{Minion Pro}
\setsansfont{Myriad Pro}
\setmonofont{Lucida Sans Typewriter}
\setCJKmainfont[BoldFont=SimHei,ItalicFont=KaiTi_GB2312]{SimSun}

%\CTEXsetup[format+={\textcolor{steelblue}}]{section}

%\CTEXsetup[format+={\kai{}}]{chapter}
%\CTEXsetup[name={,}]{chapter}

\makeatletter
\newcommand*{\cc}[1]{
\vspace*{0.5ex}\parbox[l]{\textwidth}{\textcolor{steelblue}{\rule{\textwidth}{1ex}}}
\phantomsection{}%
\addcontentsline{toc}{subsection}{#1}%
\parbox[l]{5 cm}{#1}%
\par\nobreak%\vskip %1ex\@afterheading}
}
\newcommand*{\ccl}[3]{%
  \noindent\makebox[\textwidth][m]{{#1}}%
  《\kai{{#2}}》~\pageref(#2){#3}\\}

\newcommand*{\cvline}[3][.25em]{%
  \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
 	  \raggedleft\hintfont{#2} &{#3}%
  \end{tabular}\\[#1]}  
\newcommand*{\cventry}[6]{%
  \cvline{#1}{%
    {\bfseries#2}%
    \ifthenelse{\equal{#3}{}}{}{, {\slshape#3}}%
    \ifthenelse{\equal{#4}{}}{}{, #4}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    %
%    \ifx&#6&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi%
  }}%  




\addtolength{\textwidth}{1in}
\addtolength{\oddsidemargin}{-.5in}
\addtolength{\textheight}{1in}
\addtolength{\topmargin}{-.5in}

%\usepackage{fancyhdr}
%\pagestyle{fancy} \lhead{}
%\chead{} \rhead{} \lfoot{}
%\cfoot{\thepage}
%\rfoot{}
%\renewcommand{\headheight}{13.6pt}



\usepackage[center]{titlesec}
%\titleformat{\chapter}[display]{\Huge\bfseries}{\,\thechapter\,}{1em}{}

%\titleformat{\chapter}[block]{\normalfont}
%{\filright
%\footnotesize
%\enspace SECTION \thesection\enspace}
%{8pt}
%{\Large\bfseries\filcenter}

\renewcommand\thechapter{\arabic{chapter}}
\renewcommand\thesection{~}
\renewcommand\thesubsection{\arabic{subsection}~}

%\usepackage[grey,utopia]{quotchap}
%\renewcommand\chapterheadstartvskip{\vspace*{-6\baselineskip}}% select Helvetica for title and quote
%\usepackage{helvet}
%\renewcommand\sectfont{\sffamily\bfseries}


%\usepackage{titlesec}
\newcommand\secformat[1]{%
  \parbox[b]{.75\textwidth}{\filleft\bfseries\Huge #1}%
  \quad\textcolor{lgray}{\rule[-12pt]{2pt}{70pt}}\quad
  {\fontsize{60}{60}\selectfont\textcolor{hgray}{\thechapter}}}
  
\titleformat{\chapter}[block]
  {\filleft\normalfont\sffamily}{}{0pt}{\secformat}
\titlespacing*{\chapter}{0pt}{*3}{*2}[1pc]


\titleformat{\section}{\hei\large}{\textcolor{steelblue}{\rule{2cm}{1ex}}}{1em}{\textcolor{steelblue}}

%\usepackage[noindentafter,calcwidth]{titlesec}


%\CTEXsetup[format+={\textcolor{steelblue}}]{section}

\CTEXsetup[format+={\kai{}}]{chapter}
\CTEXsetup[name={,}]{chapter}

\usepackage{pifont}
